import axios from 'axios'
import pakgetLoading from '@/utils/loding'

var instance = axios.create({
    baseURL:"http://localhost:8080/big-data",
    timeout:2500
});

// 请求拦截器
instance.interceptors.request.use(
    conf => {
        pakgetLoading.startLoading()
        return conf;
    },
    error => {
        return Promise.reject(error);
    }
)

// 响应拦截器
instance.interceptors.response.use(
    response => {
        pakgetLoading.endLoading()
        const res = response.data
        return res
},
    error => {
        pakgetLoading.endLoading()
        return Promise.reject(error)
    }
)

export default instance